

define([
        "jquery",
        "IO",
        "UPLOADUI",
        "UPLOAD",
        "jqueryUI",
        "bootbox",
        "kindeditor"
    ], function ($, IO, upui, up, jui, bootbox, definebt) {
        var  aa_questionsCount=0;//问题驱动题目总数
        var  bb_questionsCount=0;//原理反思题目总数
        var  cc_questionsCount=0;//行动目标题目总数
        var  dd_questionsCount=0;//行动反馈题目总数
        var  ee_questionsCount=0;//行动推进题目总数
        var  train_id;//培训id
        var  editor;//富文本
        $(function () {
            //---------------------------------------初始化--------------------------------------
            train_id=$('#section_mian').attr('train_id');
            $('body').css("overflow","hidden");
            $("#cover").show();
            bb_trainShow();
            aa_actionShow();
            cc_actionShow();
            dd_actionShow();
            ee_actionShow();

            editor = KindEditor.create('textarea[class="RichText"]', {
                    uploadJson : '../../upload',
                    allowFileManager : true,
                        afterCreate : function() {
                            this.sync();
                        },
                       afterChange: function(){ //编辑器内容发生变化后，将编辑器的内容设置到原来的textarea控件里
                            this.sync();
                        },
                        afterBlur : function() {
                            this.sync();
                        }

                });


            //---------------------------------------问题驱动(aa)----------------------------------------
            //点击问答题一
            $('#aa_btnProblem1').on('click',function () {
                aa1Add();
                $("#aa_content .Problem1_main:last input:first").focus();
                $("#aa_content").animate({ scrollTop: $('#aa_content')[0].scrollHeight}, 1000);
            })
            //点击问答题二
            $('#aa_btnProblem2').on('click',function () {
                aa2Add();
                $("#aa_content .Problem2_main:last input:first").focus();
                $("#aa_content").animate({ scrollTop: $('#aa_content')[0].scrollHeight}, 1000);
            })
            //点击评分
            $('#aa_btnGrade').on('click',function () {
               aa3Add();
                $("#aa_content .Grade_main:last input:first").focus();
                $("#aa_content").animate({ scrollTop: $('#aa_content')[0].scrollHeight}, 1000);
            })

            //删除题目
            $(document).on('click','.aa_deleteDiv',function () {
                var nextAll=$(this).parents("#questions").nextAll();
                var nextAllCount=nextAll.length
                var nextFirst=nextAll.first();
                for(var i=0;i<nextAllCount;i++){
                    var count=nextFirst.find('#count').text();
                    nextFirst.find('#count').text(count-1);
                    nextFirst=nextFirst.next();
                }
                if($(this).parents("#questions").attr('study_test_id')!=0){
                    $(this).parents("#questions").css('display','none');
                    $(this).parents("#questions").attr('del_flag','1');
                }else{
                    $(this).parents("#questions").remove();
                }
                aa_questionsCount-=1;
            })

            //点击发布按钮
            $('#aa_btnSubmit').on('click',function () {

                var childrenAll= $('#aa_content').children();  //获得当前aa所有题目
                var childrenCount=childrenAll.length;//题目总数
                if(childrenCount<=0){
                    bootbox.alert('请添加问题驱动题目');
                    return;
                }
                var childFirst=childrenAll.first();//第一题
                var section_type=0;//0问题驱动,2行动目标,3行动反馈,4行动推进
                var study_tag=0;//study_tag为第四个模块的 1普通问题的tag
                var studytestlist="[";
                for(var i=0;i<childrenCount;i++){
                    var study_test_id=childFirst.attr('study_test_id');//题目id
                    var study_test_type=childFirst.attr('study_test_type');//0评分题,1普通问答题,2多问答题
                    var del_flag=childFirst.attr('del_flag');//删除标记
                    var study_test_body=childFirst.find('input').val();
                    if(del_flag==0){
                        if(study_test_body==''){
                            bootbox.alert("题目"+(i+1)+"内容为空");
                            return;
                        }
                    }
                    var text=",{\"study_test_id\":"+study_test_id+"," +
                        "\"train_id\":"+train_id+"," +
                        "\"section_type\":"+section_type+"," +
                        "\"study_test_body\":\""+study_test_body+"\"," +
                        "\"study_test_type\":"+study_test_type+"," +
                        "\"del_flag\":"+del_flag+"," +
                        "\"study_tag\":"+study_tag+"}";
                    studytestlist+=text;
                    childFirst=childFirst.next();
                }
                studytestlist+="]";
                studytestlist=studytestlist.replace(',','');

                var param = {};
                param.train_id = train_id;
                param.section_type = section_type;
                param.studytestlist = studytestlist;
                param.study_test_status=1;//发布
                IO.post("/subjectsAdd", param, function (d) {
                    if (d.code == 0) {
                        aa_questionsCount=0;
                        $("#aa_content").empty();
                        aa_actionShow();
                        bootbox.alert(d.msg);
                    } else {
                        bootbox.alert(d.msg);
                    }
                });
            })
            //点击保存按钮
            $('#aa_btnSure').on('click',function () {

                var childrenAll= $('#aa_content').children();  //获得当前aa所有题目
                var childrenCount=childrenAll.length;//题目总数
                if(childrenCount<=0){
                    bootbox.alert('请添加问题驱动题目');
                    return;
                }
                var childFirst=childrenAll.first();//第一题
                var section_type=0;//0问题驱动,2行动目标,3行动反馈,4行动推进
                var study_tag=0;//study_tag为第四个模块的 1普通问题的tag
                var studytestlist="[";
                for(var i=0;i<childrenCount;i++){
                    var study_test_id=childFirst.attr('study_test_id');//题目id
                    var study_test_type=childFirst.attr('study_test_type');//0评分题,1普通问答题,2多问答题
                    var del_flag=childFirst.attr('del_flag');//删除标记
                    var study_test_body=childFirst.find('input').val();
                    if(del_flag==0){
                        if(study_test_body==''){
                            bootbox.alert("题目"+(i+1)+"内容为空");
                            return;
                        }
                    }
                    var text=",{\"study_test_id\":"+study_test_id+"," +
                        "\"train_id\":"+train_id+"," +
                        "\"section_type\":"+section_type+"," +
                        "\"study_test_body\":\""+study_test_body+"\"," +
                        "\"study_test_type\":"+study_test_type+"," +
                        "\"del_flag\":"+del_flag+"," +
                        "\"study_tag\":"+study_tag+"}";
                    studytestlist+=text;
                    childFirst=childFirst.next();
                }
                studytestlist+="]";
                studytestlist=studytestlist.replace(',','');

                var param = {};
                param.train_id = train_id;
                param.section_type = section_type;
                param.studytestlist = studytestlist;
                param.study_test_status=0;//保存
                IO.post("/subjectsAdd", param, function (d) {
                    if (d.code == 0) {
                        aa_questionsCount=0;
                        $("#aa_content").empty();
                        bootbox.alert(d.msg,function () {
                            aa_actionShow();
                        });
                    } else {
                        bootbox.alert(d.msg);
                    }
                });
            })


            //----------------------------------------原理反思(bb)----------------------------------------
            // 点击新增词汇
            $('#bb_btnWords').on('click',function () {
                bbAdd();
                $("#bb_content .Words_main:last input:first").focus();
                $("#bb_content").animate({ scrollTop: $('#bb_content')[0].scrollHeight-900}, 1000);
            })
            // 删除词汇
            $(document).on('click','.bb_deleteDiv',function () {

                var nextAll=$(this).parents(".Words_main").nextAll();
                var nextAllCount=nextAll.length
                var nextFirst=nextAll.first();

                for(var i=0;i<nextAllCount;i++){
                    var count=nextFirst.find('#count').text();
                    nextFirst.find('#count').text(count-1);
                    nextFirst=nextFirst.next();
                }
                if($(this).parents(".Words_main").attr('vocabulary_id1')==0&&$(this).parents(".Words_main").attr('vocabulary_id2')==0){
                    $(this).parents(".Words_main").remove();
                }else{
                    $(this).parents(".Words_main").css('display','none');
                    $(this).parents(".Words_main").attr('del_flag','1')
                }
                bb_questionsCount-=1;

            })
            //点击发布按钮
            $('#bb_btnSubmit').on('click',function () {

                //获得所有词汇题目
                var childrenAll = $('#bb_content').children();//所有词汇题
                var childrenCount = childrenAll.length;
                if (childrenCount <= 0) {
                    bootbox.alert('请添加词汇题');
                    return;
                }
                var children = childrenAll.first()//第一道词汇题
                var VocabularyList = "[";//题目存储;
                for (var i = 0; i < childrenCount; i++) {
                    var vocabulary_id1 = children.attr('vocabulary_id1');//词汇标记新增0,其他修改 二级词汇1
                    var vocabulary_id2 = children.attr('vocabulary_id2');//词汇标记新增0,其他修改 二级词汇2
                    var del_flag = children.attr('del_flag');//词汇标记,删除
                    var vocabulary_title = children.find('.vocabulary_title').val(); // 标题
                    var vocabulary_section = children.find('.vocabulary_section').val(); // 一级词汇
                    var vocabulary_name1 = children.find('.vocabulary_name1').val() // 二级词汇1
                    var vocabulary_name2 = children.find('.vocabulary_name2').val()  // 二级词汇2
                    var vocabulary_desc1 = children.find('.vocabulary_desc1').val().replace(/\"/g, "\'") .toString();  // 二级词汇1解释
                    var vocabulary_desc2 = children.find('.vocabulary_desc2').val().replace(/\"/g, "\'").toString(); // 二级词汇2解释
                    var vocabulary_type1 = children.find('.vocabulary_type1').is(':checked') == true ? 1 : 0;  // 二级词汇1选择情况
                    var vocabulary_type2 = children.find('.vocabulary_type2').is(':checked') == true ? 1 : 0;  // 二级词汇2选择情况
                    if(del_flag==0){
                    if(vocabulary_title==""){
                        bootbox.alert("第"+(i+1)+"题标题为空");
                        return;
                    }
                    if(vocabulary_section==""){
                        bootbox.alert("第"+(i+1)+"题一级词汇为空");
                        return;
                    }
                    if(vocabulary_name1==""){
                        bootbox.alert("第"+(i+1)+"题二级词汇1为空");
                        return;
                    }
                    if(vocabulary_name2==""){
                        bootbox.alert("第"+(i+1)+"题二级词汇2为空");
                        return;
                    }
                    if(vocabulary_desc1==""){
                        bootbox.alert("第"+(i+1)+"题二级词汇1解释为空");
                        return;
                    }
                    if(vocabulary_desc2==""){
                        bootbox.alert("第"+(i+1)+"题二级词汇2解释为空");
                        return;
                    }
                    }
                    vocabulary_desc1="<html><head><title></title><style>img {width: 100%;}</style></head><body>"+vocabulary_desc1.replace(/(?=[^>]*(?=<))\s+/g,"")+"</body></html>";
                    vocabulary_desc2="<html><head><title></title><style>img {width: 100%;}</style></head><body>"+vocabulary_desc2.replace(/(?=[^>]*(?=<))\s+/g,"")+"</body></html>";
                    var Vocabulary1 = ",{\"vocabulary_id\":" + vocabulary_id1 + " ," +
                        "\"train_id\":" + train_id + "," +
                        "\"vocabulary_name\":\"" + vocabulary_name1 + "\"," +
                        "\"vocabulary_section\":\"" + vocabulary_section + "\"," +
                        "\"vocabulary_desc\":\"" + vocabulary_desc1 + "\"," +
                        "\"del_flag\":" + del_flag + "," +
                        "\"vocabulary_type\":" + vocabulary_type1 + "," +
                        "\"vocabulary_title\":\"" + vocabulary_title + "\"},";
                    var Vocabulary2 = "{\"vocabulary_id\":" + vocabulary_id2 + " ," +
                        "\"train_id\":" + train_id + "," +
                        "\"vocabulary_name\":\"" + vocabulary_name2 + "\"," +
                        "\"vocabulary_section\":\"" + vocabulary_section + "\"," +
                        "\"vocabulary_desc\":\"" + vocabulary_desc2 + "\"," +
                        "\"del_flag\":" + del_flag + "," +
                        "\"vocabulary_type\":" + vocabulary_type2 + "," +
                        "\"vocabulary_title\":\"" + vocabulary_title + "\"}";
                    VocabularyList += Vocabulary1
                    VocabularyList += Vocabulary2
                    children = children.next();
                }

                VocabularyList += "]";

                var param = {};
                param.train_id = train_id;
                param.VocabularyList = VocabularyList.replace(',', '');
                param.study_test_status=1;//发布
                IO.post("/vocabularysAdd", param, function (d) {
                    if (d.code == 0) {
                        bb_questionsCount=0;
                        bootbox.alert((d.msg),function () {
                            location.reload();
                        });

                    } else {
                        bootbox.alert(d.msg);
                    }
                });

            })
            //checkbox1选择
            $(document).on('click','.checkbox1',function () {
               var checked= $(this).parents('.Words_main').find('.checkbox1').is(':checked')
               if (checked){
                   $(this).parents('.Words_main').find('.checkbox2').attr("checked",false);
               }else{
                   $(this).parents('.Words_main').find('.checkbox2').attr("checked",true);
               }

            });
            //checkbox2选择
            $(document).on('click','.checkbox2',function () {
                var checked= $(this).parents('.Words_main').find('.checkbox2').is(':checked')
                if (checked){
                    $(this).parents('.Words_main').find('.checkbox1').attr("checked",false);
                }else{
                    $(this).parents('.Words_main').find('.checkbox1').attr("checked",true);
                }

            });
            //点击保存按钮
            $('#bb_btnSure').on('click',function () {

                //获得所有词汇题目
                var childrenAll = $('#bb_content').children();//所有词汇题
                var childrenCount = childrenAll.length;
                if (childrenCount <= 0) {
                    bootbox.alert('请添加词汇题');
                    return;
                }
                var children = childrenAll.first()//第一道词汇题
                var VocabularyList = "[";//题目存储;
                for (var i = 0; i < childrenCount; i++) {
                    var vocabulary_id1 = children.attr('vocabulary_id1');//词汇标记新增0,其他修改 二级词汇1
                    var vocabulary_id2 = children.attr('vocabulary_id2');//词汇标记新增0,其他修改 二级词汇2
                    var del_flag = children.attr('del_flag');//词汇标记,删除
                    var vocabulary_title = children.find('.vocabulary_title').val(); // 标题
                    var vocabulary_section = children.find('.vocabulary_section').val(); // 一级词汇
                    var vocabulary_name1 = children.find('.vocabulary_name1').val() // 二级词汇1
                    var vocabulary_name2 = children.find('.vocabulary_name2').val()  // 二级词汇2
                    var vocabulary_desc1 = children.find('.vocabulary_desc1').val().replace(/\"/g, "\'");  // 二级词汇1解释
                    var vocabulary_desc2 = children.find('.vocabulary_desc2').val().replace(/\"/g, "\'");  // 二级词汇2解释
                    var vocabulary_type1 = children.find('.vocabulary_type1').is(':checked') == true ? 1 : 0;  // 二级词汇1选择情况
                    var vocabulary_type2 = children.find('.vocabulary_type2').is(':checked') == true ? 1 : 0;  // 二级词汇2选择情况
                    if(del_flag==0){
                        if(vocabulary_title==""){
                            bootbox.alert("第"+(i+1)+"题标题为空");
                            return;
                        }
                        if(vocabulary_section==""){
                            bootbox.alert("第"+(i+1)+"题一级词汇为空");
                            return;
                        }
                        if(vocabulary_name1==""){
                            bootbox.alert("第"+(i+1)+"题二级词汇1为空");
                            return;
                        }
                        if(vocabulary_name2==""){
                            bootbox.alert("第"+(i+1)+"题二级词汇2为空");
                            return;
                        }
                        if(vocabulary_desc1==""){
                            bootbox.alert("第"+(i+1)+"题二级词汇1解释为空");
                            return;
                        }
                        if(vocabulary_desc2==""){
                            bootbox.alert("第"+(i+1)+"题二级词汇2解释为空");
                            return;
                        }
                    }

                    vocabulary_desc1="<html><head><title></title><style>img {width: 100%;}</style></head><body>"+vocabulary_desc1.replace(/(?=[^>]*(?=<))\s+/g,"")+"</body></html>";
                    vocabulary_desc2="<html><head><title></title><style>img {width: 100%;}</style></head><body>"+vocabulary_desc2.replace(/(?=[^>]*(?=<))\s+/g,"")+"</body></html>";

                    var Vocabulary1 = ",{\"vocabulary_id\":" + vocabulary_id1 + " ," +
                        "\"train_id\":" + train_id + "," +
                        "\"vocabulary_name\":\"" + vocabulary_name1 + "\"," +
                        "\"vocabulary_section\":\"" + vocabulary_section + "\"," +
                        "\"vocabulary_desc\":\"" + vocabulary_desc1 + "\"," +
                        "\"del_flag\":" + del_flag + "," +
                        "\"vocabulary_type\":" + vocabulary_type1 + "," +
                        "\"vocabulary_title\":\"" + vocabulary_title + "\"},";
                    var Vocabulary2 = "{\"vocabulary_id\":" + vocabulary_id2 + " ," +
                        "\"train_id\":" + train_id + "," +
                        "\"vocabulary_name\":\"" + vocabulary_name2 + "\"," +
                        "\"vocabulary_section\":\"" + vocabulary_section + "\"," +
                        "\"vocabulary_desc\":\"" + vocabulary_desc2 + "\"," +
                        "\"del_flag\":" + del_flag + "," +
                        "\"vocabulary_type\":" + vocabulary_type2 + "," +
                        "\"vocabulary_title\":\"" + vocabulary_title + "\"}";
                    VocabularyList += Vocabulary1;
                    VocabularyList += Vocabulary2
                    children = children.next();
                }

                VocabularyList += "]";
                var param = {};
                param.train_id = train_id;
                param.VocabularyList = VocabularyList.replace(',',"");;
                param.study_test_status=0;//保存
                IO.post("/vocabularysAdd", param, function (d) {
                    if (d.code == 0) {
                        bb_questionsCount=0;
                        bootbox.alert(d.msg,function () {
                            location.reload();
                        });

                    } else {
                        bootbox.alert(d.msg);
                    }
                });

            })



            //----------------------------------------行动目标(cc)----------------------------------------
            //点击问答题一
            $('#cc_btnProblem1').on('click',function () {
                cc1Add();
                $("#cc_content .Problem1_main:last input:first").focus();
                $("#cc_content").animate({ scrollTop: $('#cc_content')[0].scrollHeight}, 1000);
            })
            //点击问答题二
            $('#cc_btnProblem2').on('click',function () {
                cc2Add();
                $("#cc_content .Problem2_main:last input:first").focus();
                $("#cc_content").animate({ scrollTop: $('#cc_content')[0].scrollHeight}, 1000);
            })
            //点击评分
            $('#cc_btnGrade').on('click',function () {
                cc3Add();
                $("#cc_content .Grade_main:last input:first").focus();
                $("#cc_content").animate({ scrollTop: $('#cc_content')[0].scrollHeight}, 1000);
            })

            //删除题目
            $(document).on('click','.cc_deleteDiv',function () {
                var nextAll=$(this).parents("#questions").nextAll();
                var nextAllCount=nextAll.length
                var nextFirst=nextAll.first();
                for(var i=0;i<nextAllCount;i++){
                    var count=nextFirst.find('#count').text();
                    nextFirst.find('#count').text(count-1);
                    nextFirst=nextFirst.next();
                }
                if($(this).parents("#questions").attr('study_test_id')!=0){
                    $(this).parents("#questions").css('display','none');
                    $(this).parents("#questions").attr('del_flag','1');
                }else{
                    $(this).parents("#questions").remove();
                }
                cc_questionsCount-=1;
            })

            //点击发布按钮
            $('#cc_btnSubmit').on('click',function () {

                var childrenAll= $('#cc_content').children();  //获得当前aa所有题目
                var childrenCount=childrenAll.length;//题目总数
                if(childrenCount<=0){
                    bootbox.alert('请添加行动目标题目');
                    return;
                }
                var childFirst=childrenAll.first();//第一题
                var section_type=2;//0问题驱动,2行动目标,3行动反馈,4行动推进
                var study_tag=0;//study_tag为第四个模块的 1普通问题的tag
                var studytestlist="[";
                for(var i=0;i<childrenCount;i++){
                    var study_test_id=childFirst.attr('study_test_id');//题目id
                    var study_test_type=childFirst.attr('study_test_type');//0评分题,1普通问答题,2多问答题
                    var del_flag=childFirst.attr('del_flag');//删除标记
                    var study_test_body=childFirst.find('input').val();
                    if(del_flag==0){
                        if(study_test_body==''){
                            bootbox.alert("题目"+(i+1)+"内容为空");
                            return;
                        }
                    }
                    var text=",{\"study_test_id\":"+study_test_id+"," +
                        "\"train_id\":"+train_id+"," +
                        "\"section_type\":"+section_type+"," +
                        "\"study_test_body\":\""+study_test_body+"\"," +
                        "\"study_test_type\":"+study_test_type+"," +
                        "\"del_flag\":"+del_flag+"," +
                        "\"study_tag\":"+study_tag+"}";
                    studytestlist+=text;
                    childFirst=childFirst.next();
                }
                studytestlist+="]";
                studytestlist=studytestlist.replace(',','');

                var param = {};
                param.train_id = train_id;
                param.section_type = section_type;
                param.studytestlist = studytestlist;
                param.study_test_status=1;//发布
                IO.post("/subjectsAdd", param, function (d) {
                    if (d.code == 0) {
                        cc_questionsCount=0;
                        $("#cc_content").empty();
                        bootbox.alert(d.msg,function () {
                            cc_actionShow();
                        });
                    } else {
                        bootbox.alert(d.msg);
                    }
                });
            })
            //点击保存按钮
            $('#cc_btnSure').on('click',function () {

                var childrenAll= $('#cc_content').children();  //获得当前aa所有题目
                var childrenCount=childrenAll.length;//题目总数
                if(childrenCount<=0){
                    bootbox.alert('请添加行动目标题目');
                    return;
                }
                var childFirst=childrenAll.first();//第一题
                var section_type=2;//0问题驱动,2行动目标,3行动反馈,4行动推进
                var study_tag=0;//study_tag为第四个模块的 1普通问题的tag
                var studytestlist="[";
                for(var i=0;i<childrenCount;i++){
                    var study_test_id=childFirst.attr('study_test_id');//题目id
                    var study_test_type=childFirst.attr('study_test_type');//0评分题,1普通问答题,2多问答题
                    var del_flag=childFirst.attr('del_flag');//删除标记
                    var study_test_body=childFirst.find('input').val();
                    if(del_flag==0){
                        if(study_test_body==''){
                            bootbox.alert("题目"+(i+1)+"内容为空");
                            return;
                        }
                    }
                    var text=",{\"study_test_id\":"+study_test_id+"," +
                        "\"train_id\":"+train_id+"," +
                        "\"section_type\":"+section_type+"," +
                        "\"study_test_body\":\""+study_test_body+"\"," +
                        "\"study_test_type\":"+study_test_type+"," +
                        "\"del_flag\":"+del_flag+"," +
                        "\"study_tag\":"+study_tag+"}";
                    studytestlist+=text;
                    childFirst=childFirst.next();
                }
                studytestlist+="]";
                studytestlist=studytestlist.replace(',','');

                var param = {};
                param.train_id = train_id;
                param.section_type = section_type;
                param.studytestlist = studytestlist;
                param.study_test_status=0;//保存
                IO.post("/subjectsAdd", param, function (d) {
                    if (d.code == 0) {
                        cc_questionsCount=0;
                        $("#cc_content").empty();
                        bootbox.alert(d.msg,function () {
                            cc_actionShow();
                        });
                    } else {
                        bootbox.alert(d.msg);
                    }
                });
            })
          
            //----------------------------------------行动反馈(dd)----------------------------------------
            //点击问答题一
             $('#dd_btnProblem1').on('click',function () {
                 dd1Add();
                 $("#dd_content .Problem1_main:last input:first").focus();
                 $("#dd_content").animate({ scrollTop: $('#dd_content')[0].scrollHeight}, 1000);
             })
            //点击问答题二
             $('#dd_btnProblem2').on('click',function () {
                 dd2Add();
                 $("#dd_content .Problem2_main:last input:first").focus();
                 $("#dd_content").animate({ scrollTop: $('#dd_content')[0].scrollHeight}, 1000);
             })
             //点击评分
              $('#dd_btnGrade').on('click',function () {
                  dd3Add();
                  $("#dd_content .Grade_main:last input:first").focus();
                  $("#dd_content").animate({ scrollTop: $('#dd_content')[0].scrollHeight}, 1000);
              })
            //删除题目
            $(document).on('click','.dd_deleteDiv',function () {
                var nextAll=$(this).parents("#questions").nextAll();
                var nextAllCount=nextAll.length
                var nextFirst=nextAll.first();
                for(var i=0;i<nextAllCount;i++){
                    var count=nextFirst.find('#count').text();
                    nextFirst.find('#count').text(count-1);
                    nextFirst=nextFirst.next();
                }
                if($(this).parents("#questions").attr('study_test_id')!=0){
                    $(this).parents("#questions").css('display','none');
                    $(this).parents("#questions").attr('del_flag','1');
                }else{
                    $(this).parents("#questions").remove();
                }
                dd_questionsCount-=1;
            })

            //点击发布按钮
            $('#dd_btnSubmit').on('click',function () {

                var childrenAll= $('#dd_content').children();  //获得当前aa所有题目
                var childrenCount=childrenAll.length;//题目总数
                if(childrenCount<=0){
                    bootbox.alert('请添加行动反馈题目');
                    return;
                }
                var childFirst=childrenAll.first();//第一题
                var section_type=3;//0问题驱动,2行动目标,3行动反馈,4行动推进
                var study_tag=0;//study_tag为第四个模块的 1普通问题的tag
                var studytestlist="[";
                for(var i=0;i<childrenCount;i++){
                    var study_test_id=childFirst.attr('study_test_id');//题目id
                    var study_test_type=childFirst.attr('study_test_type');//0评分题,1普通问答题,2多问答题
                    var del_flag=childFirst.attr('del_flag');//删除标记
                    var study_test_body=childFirst.find('input').val();
                    if(del_flag==0){
                        if(study_test_body==''){
                            bootbox.alert("题目"+(i+1)+"内容为空");
                            return;
                        }
                    }
                    var text=",{\"study_test_id\":"+study_test_id+"," +
                        "\"train_id\":"+train_id+"," +
                        "\"section_type\":"+section_type+"," +
                        "\"study_test_body\":\""+study_test_body+"\"," +
                        "\"study_test_type\":"+study_test_type+"," +
                        "\"del_flag\":"+del_flag+"," +
                        "\"study_tag\":"+study_tag+"}";
                    studytestlist+=text;
                    childFirst=childFirst.next();
                }
                studytestlist+="]";
                studytestlist=studytestlist.replace(',','');

                var param = {};
                param.train_id = train_id;
                param.section_type = section_type;
                param.studytestlist = studytestlist;
                param.study_test_status=1;//发布
                IO.post("/subjectsAdd", param, function (d) {
                    if (d.code == 0) {
                        dd_questionsCount=0;
                        $("#dd_content").empty();
                        bootbox.alert(d.msg,function () {
                            dd_actionShow();
                        });
                    } else {
                        bootbox.alert(d.msg);
                    }
                });
            })
            //点击保存按钮
            $('#dd_btnSure').on('click',function () {

                var childrenAll= $('#dd_content').children();  //获得当前aa所有题目
                var childrenCount=childrenAll.length;//题目总数
                if(childrenCount<=0){
                    bootbox.alert('请添加行动反馈题目');
                    return;
                }
                var childFirst=childrenAll.first();//第一题
                var section_type=3;//0问题驱动,2行动目标,3行动反馈,4行动推进
                var study_tag=0;//study_tag为第四个模块的 1普通问题的tag
                var studytestlist="[";
                for(var i=0;i<childrenCount;i++){
                    var study_test_id=childFirst.attr('study_test_id');//题目id
                    var study_test_type=childFirst.attr('study_test_type');//0评分题,1普通问答题,2多问答题
                    var del_flag=childFirst.attr('del_flag');//删除标记
                    var study_test_body=childFirst.find('input').val();
                    if(del_flag==0){
                        if(study_test_body==''){
                            bootbox.alert("题目"+(i+1)+"内容为空");
                            return;
                        }
                    }
                    var text=",{\"study_test_id\":"+study_test_id+"," +
                        "\"train_id\":"+train_id+"," +
                        "\"section_type\":"+section_type+"," +
                        "\"study_test_body\":\""+study_test_body+"\"," +
                        "\"study_test_type\":"+study_test_type+"," +
                        "\"del_flag\":"+del_flag+"," +
                        "\"study_tag\":"+study_tag+"}";
                    studytestlist+=text;
                    childFirst=childFirst.next();
                }
                studytestlist+="]";
                studytestlist=studytestlist.replace(',','');

                var param = {};
                param.train_id = train_id;
                param.section_type = section_type;
                param.studytestlist = studytestlist;
                param.study_test_status=0;//保存
                IO.post("/subjectsAdd", param, function (d) {
                    if (d.code == 0) {
                        dd_questionsCount=0;
                        $("#dd_content").empty();
                        bootbox.alert(d.msg,function () {
                            dd_actionShow();
                        });
                    } else {
                        bootbox.alert(d.msg);
                    }
                });
            })

            //----------------------------------------行动推进(ee)----------------------------------------
            //点击问答题一
            $('#ee_btnProblem1').on('click',function () {
                ee1Add();
                $("#ee_content .Problem1_main:last input:first").focus();
                $("#ee_content").animate({ scrollTop: $('#ee_content')[0].scrollHeight}, 1000);
            })
            //点击问答题二
            $('#ee_btnProblem2').on('click',function () {
                ee2Add();
                $("#ee_content .Problem2_main:last input:first").focus();
                $("#ee_content").animate({ scrollTop: $('#ee_content')[0].scrollHeight}, 1000);
            })
           //点击评分
            $('#ee_btnGrade').on('click',function () {
                ee3Add();
                $("#ee_content .Grade_main:last input:first").focus();
                $("#ee_content").animate({ scrollTop: $('#ee_content')[0].scrollHeight}, 1000);
            })
            //删除题目
            $(document).on('click','.ee_deleteDiv',function () {
                var nextAll=$(this).parents("#questions").nextAll();
                var nextAllCount=nextAll.length
                var nextFirst=nextAll.first();
                for(var i=0;i<nextAllCount;i++){
                    var count=nextFirst.find('#count').text();
                    nextFirst.find('#count').text(count-1);
                    nextFirst=nextFirst.next();
                }
                if($(this).parents("#questions").attr('study_test_id')!=0){
                    $(this).parents("#questions").css('display','none');
                    $(this).parents("#questions").attr('del_flag','1');
                }else{
                    $(this).parents("#questions").remove();
                }
                ee_questionsCount-=1;
            })

            //点击发布按钮
            $('#ee_btnSubmit').on('click',function () {

                var childrenAll= $('#ee_content').children();  //获得当前aa所有题目
                var childrenCount=childrenAll.length;//题目总数
                if(childrenCount<=0){
                    bootbox.alert('请添加行动推进题目');
                    return;
                }
                var childFirst=childrenAll.first();//第一题
                var section_type=4;//0问题驱动,2行动目标,3行动反馈,4行动推进
                var study_tag=0;//study_tag为第四个模块的 1普通问题的tag
                var studytestlist="[";
                for(var i=0;i<childrenCount;i++){
                    var study_test_id=childFirst.attr('study_test_id');//题目id
                    var study_test_type=childFirst.attr('study_test_type');//0评分题,1普通问答题,2多问答题
                    if(study_test_type==1){//1普通问答题
                        study_tag=childFirst.find('.vocabulary_type').is(':checked') == true ? 1 : 0;
                    }
                    var del_flag=childFirst.attr('del_flag');//删除标记
                    var study_test_body=childFirst.find('input').val();
                    if(del_flag==0){
                        if(study_test_body==''){
                            bootbox.alert("题目"+(i+1)+"内容为空");
                            return;
                        }
                    }
                    var text=",{\"study_test_id\":"+study_test_id+"," +
                        "\"train_id\":"+train_id+"," +
                        "\"section_type\":"+section_type+"," +
                        "\"study_test_body\":\""+study_test_body+"\"," +
                        "\"study_test_type\":"+study_test_type+"," +
                        "\"del_flag\":"+del_flag+"," +
                        "\"study_tag\":"+study_tag+"}";
                    studytestlist+=text;
                    childFirst=childFirst.next();
                }
                studytestlist+="]";
                studytestlist=studytestlist.replace(',','');
                var param = {};
                param.train_id = train_id;
                param.section_type = section_type;
                param.studytestlist = studytestlist;
                param.study_test_status=1;//发布
                IO.post("/subjectsAdd", param, function (d) {
                    if (d.code == 0) {
                        ee_questionsCount=0;
                        $("#ee_content").empty();
                        bootbox.alert(d.msg,function () {
                            ee_actionShow();
                        });
                    } else {
                        bootbox.alert(d.msg);
                    }
                });
            })
            //点击保存按钮
            $('#ee_btnSure').on('click',function () {

                var childrenAll= $('#ee_content').children();  //获得当前aa所有题目
                var childrenCount=childrenAll.length;//题目总数
                if(childrenCount<=0){
                    bootbox.alert('请添加行动推进题目');
                    return;
                }
                var childFirst=childrenAll.first();//第一题
                var section_type=4;//0问题驱动,2行动目标,3行动反馈,4行动推进
                var study_tag=0;//study_tag为第四个模块的 1普通问题的tag
                var studytestlist="[";
                for(var i=0;i<childrenCount;i++){
                    var study_test_id=childFirst.attr('study_test_id');//题目id
                    var study_test_type=childFirst.attr('study_test_type');//0评分题,1普通问答题,2多问答题
                    if(study_test_type==1){//1普通问答题
                        study_tag=childFirst.find('.vocabulary_type').is(':checked') == true ? 1 : 0;
                    }
                    var del_flag=childFirst.attr('del_flag');//删除标记
                    var study_test_body=childFirst.find('input').val();
                    if(del_flag==0){
                        if(study_test_body==''){
                            bootbox.alert("题目"+(i+1)+"内容为空");
                            return;
                        }
                    }
                    var text=",{\"study_test_id\":"+study_test_id+"," +
                        "\"train_id\":"+train_id+"," +
                        "\"section_type\":"+section_type+"," +
                        "\"study_test_body\":\""+study_test_body+"\"," +
                        "\"study_test_type\":"+study_test_type+"," +
                        "\"del_flag\":"+del_flag+"," +
                        "\"study_tag\":"+study_tag+"}";
                    studytestlist+=text;
                    childFirst=childFirst.next();
                }
                studytestlist+="]";
                studytestlist=studytestlist.replace(',','');

                var param = {};
                param.train_id = train_id;
                param.section_type = section_type;
                param.studytestlist = studytestlist;
                param.study_test_status=0;//保存
                IO.post("/subjectsAdd", param, function (d) {
                    if (d.code == 0) {
                        ee_questionsCount=0;
                        $("#ee_content").empty();
                        bootbox.alert(d.msg,function () {
                            ee_actionShow();
                        });
                    } else {
                        bootbox.alert(d.msg);
                    }
                });
            })
            //----------------------------------------公用方法--------------------------------------------
            //问题一鼠标移动
            $(document).on('mouseleave','.Problem1_main',function(event){

                $(this).css('border','1px solid gainsboro')
            });
            $(document).on('mouseenter','.Problem1_main',function(event){

                $(this).css('border','2px solid #6ab7ad')
            });

            //问题二鼠标移动
            $(document).on('mouseleave','.Problem2_main',function(event){

                $(this).css('border','1px solid gainsboro')
            });
            $(document).on('mouseenter','.Problem2_main',function(event){

                $(this).css('border','2px solid #6ab7ad')
            });

            //评论鼠标移动
            $(document).on('mouseleave','.Grade_main',function(event){

                $(this).css('border','1px solid gainsboro')
            });
            $(document).on('mouseenter','.Grade_main',function(event){

                $(this).css('border','2px solid #6ab7ad')
            });
            //词汇鼠标移动
            $(document).on('mouseleave','.Words_main',function(event){

                $(this).css('border','1px solid gainsboro')
            });
            $(document).on('mouseenter','.Words_main',function(event){

                $(this).css('border','2px solid #6ab7ad')
            });
            //删除图标颜色
            $(document).on('mouseleave','.aa_deleteDiv',function(event){
                $(this).css('background-color','rgb(0,0,0,0)')
            });
            $(document).on('mouseenter','.aa_deleteDiv',function(event){
                $(this).css('background-color','gainsboro')

            });
            $(document).on('mouseleave','.bb_deleteDiv',function(event){
                $(this).css('background-color','rgb(0,0,0,0)')
            });
            $(document).on('mouseenter','.bb_deleteDiv',function(event){
                $(this).css('background-color','gainsboro')

            });
            $(document).on('mouseleave','.cc_deleteDiv',function(event){
                $(this).css('background-color','rgb(0,0,0,0)')
            });
            $(document).on('mouseenter','.cc_deleteDiv',function(event){
                $(this).css('background-color','gainsboro')

            });
            $(document).on('mouseleave','.dd_deleteDiv',function(event){
                $(this).css('background-color','rgb(0,0,0,0)')
            });
            $(document).on('mouseenter','.dd_deleteDiv',function(event){
                $(this).css('background-color','gainsboro')
            });
            $(document).on('mouseleave','.ee_deleteDiv',function(event){
                $(this).css('background-color','rgb(0,0,0,0)')
            });
            $(document).on('mouseenter','.ee_deleteDiv',function(event){
                $(this).css('background-color','gainsboro')

            });



            //bb初始化词汇
            function bb_trainShow() {
                var param={};
                param.train_id=train_id;
                param.listType=0;
                IO.get("/vocabularysShow",param,function(d){
                    if(d.code==0){
                        var dataAll=d.data;
                        var dataCount=dataAll.length;
                        for (var i=0;i<dataCount;i++) {
                            var count=dataAll[i].vocabularyTitle.length;
                            for (var j = 0; j <count ; j++) {
                                var dataSection = dataAll[i].vocabularyTitle[j].vocabularySection;// 标题
                                var vocabulary_title = dataSection[0].vocabulary_title;//标题
                                var vocabulary_section = dataSection[0].vocabulary_section; //一级词汇
                                var vocabulary_name1 = dataSection[0].vocabulary_name;      // 二级词汇1
                                var vocabulary_name2 = dataSection[1].vocabulary_name; // 二级词汇2
                                var vocabulary_desc1 = dataSection[0].vocabulary_desc; // 二级词汇1解释
                                var vocabulary_desc2 = dataSection[1].vocabulary_desc; // 二级词汇2解释
                                var vocabulary_type1 = dataSection[0].vocabulary_type;// 二级词汇1选择情况
                                var vocabulary_type2 = dataSection[1].vocabulary_type;// 二级词汇2选择情况
                                var vocabulary_id1 = dataSection[0].vocabulary_id;  // 二级词汇1 id
                                var vocabulary_id2 = dataSection[1].vocabulary_id;  // 二级词汇2id
                                bbAdd ();
                                var childrenLast = $ ( "#bb_content" ).children ().last ();
                                childrenLast.attr ( 'vocabulary_id1', vocabulary_id1 );//词汇标记新增0,其他修改 二级词汇1
                                childrenLast.attr ( 'vocabulary_id2', vocabulary_id2 );//词汇标记新增0,其他修改 二级词汇2
                                childrenLast.attr ( 'del_flag', 0 );//词汇标记,删除
                                childrenLast.find ( '.vocabulary_title' ).val ( vocabulary_title ); // 标题
                                childrenLast.find ( '.vocabulary_section' ).val ( vocabulary_section ); // 一级词汇
                                childrenLast.find ( '.vocabulary_name1' ).val ( vocabulary_name1 ) // 二级词汇1
                                childrenLast.find ( '.vocabulary_name2' ).val ( vocabulary_name2 )  // 二级词汇2
                                childrenLast.find ( '.vocabulary_desc1' ).val ( vocabulary_desc1 );  // 二级词汇1解释
                                childrenLast.find ( '.vocabulary_desc2' ).val ( vocabulary_desc2 );  // 二级词汇2解释
                                if (vocabulary_type1 == 0) {// 二级词汇1选择情况
                                    childrenLast.find ( '.vocabulary_type1' ).attr ( "checked", false );
                                } else {
                                    childrenLast.find ( '.vocabulary_type1' ).attr ( "checked", true );
                                }
                                if (vocabulary_type2 == 0) {// 二级词汇1选择情况
                                    childrenLast.find ( '.vocabulary_type2' ).attr ( "checked", false );
                                } else {
                                    childrenLast.find ( '.vocabulary_type2' ).attr ( "checked", true );
                                }

                            }
                        }

                    }else{
                        console.log(d.msg);
                    }
                });
            }
            //aa初始化题目
            function aa_actionShow() {
                var param={};
                param.train_id=train_id;
                param.section_type=0;
                param.listType=0;
                IO.get("/subjectsShow",param,function(d) {
                    if ( d.code == 0 ) {
                        var dataAll=d.data;
                        var dataCount = dataAll.length;//题目总数
                        for ( var i = 0 ; i < dataCount ; i ++ ) {
                            var study_test_type=dataAll[i].study_test_type;//题目类型
                            var study_test_body=dataAll[i].study_test_body;//题目内容
                            var study_test_id=dataAll[i].study_test_id;//题目id
                            switch ( study_test_type ) {
                                case 0://评分题
                                    aa3Add ();
                                    var childLast = $ ( '#aa_content' ).children ().last ();//最后一题
                                    childLast.attr('study_test_id',study_test_id);
                                    childLast.find('input').val(study_test_body);
                                    break;
                                case 1:
                                    aa1Add ();//普通问答题
                                    var childLast = $ ( '#aa_content' ).children ().last ();//最后一题
                                    childLast.attr('study_test_id',study_test_id);
                                    childLast.find('input').val(study_test_body);
                                    break;
                                case 2:
                                    aa2Add ();//多问答题
                                    var childLast = $ ( '#aa_content' ).children ().last ();//最后一题
                                    childLast.attr('study_test_id',study_test_id);
                                    childLast.find('input').val(study_test_body);
                                    break;
                            }
                        }


                    }else{
                    }
                });
            }
            //cc初始化题目
            function cc_actionShow() {
                var param={};
                param.train_id=train_id;
                param.section_type=2;
                param.listType=0;
                IO.get("/subjectsShow",param,function(d) {
                    if ( d.code == 0 ) {
                        var dataAll=d.data;
                        var dataCount = dataAll.length;//题目总数
                        for ( var i = 0 ; i < dataCount ; i ++ ) {
                            var study_test_type=dataAll[i].study_test_type;//题目类型
                            var study_test_body=dataAll[i].study_test_body;//题目内容
                            var study_test_id=dataAll[i].study_test_id;//题目id
                            switch ( study_test_type ) {
                                case 0://评分题
                                    cc3Add ();
                                    var childLast = $ ( '#cc_content' ).children ().last ();//最后一题
                                    childLast.attr('study_test_id',study_test_id);
                                    childLast.find('input').val(study_test_body);
                                    break;
                                case 1:
                                    cc1Add ();//普通问答题
                                    var childLast = $ ( '#cc_content' ).children ().last ();//最后一题
                                    childLast.attr('study_test_id',study_test_id);
                                    childLast.find('input').val(study_test_body);
                                    break;
                                case 2:
                                    cc2Add ();//多问答题
                                    var childLast = $ ( '#cc_content' ).children ().last ();//最后一题
                                    childLast.attr('study_test_id',study_test_id);
                                    childLast.find('input').val(study_test_body);
                                    break;
                            }
                        }


                    }
                });
            }
            //dd初始化题目
            function dd_actionShow() {
                var param={};
                param.train_id=train_id;
                param.section_type=3;
                param.listType=0;
                IO.get("/subjectsShow",param,function(d) {
                    if ( d.code == 0 ) {
                        var dataAll=d.data;
                        var dataCount = dataAll.length;//题目总数
                        for ( var i = 0 ; i < dataCount ; i ++ ) {
                            var study_test_type=dataAll[i].study_test_type;//题目类型
                            var study_test_body=dataAll[i].study_test_body;//题目内容
                            var study_test_id=dataAll[i].study_test_id;//题目id
                            switch ( study_test_type ) {
                                case 0://评分题
                                    dd3Add ();
                                    var childLast = $ ( '#dd_content' ).children ().last ();//最后一题
                                    childLast.attr('study_test_id',study_test_id);
                                    childLast.find('input').val(study_test_body);
                                    break;
                                case 1:
                                    dd1Add ();//普通问答题
                                    var childLast = $ ( '#dd_content' ).children ().last ();//最后一题
                                    childLast.attr('study_test_id',study_test_id);
                                    childLast.find('input').val(study_test_body);
                                    break;
                                case 2:
                                    dd2Add ();//多问答题
                                    var childLast = $ ( '#dd_content' ).children ().last ();//最后一题
                                    childLast.attr('study_test_id',study_test_id);
                                    childLast.find('input').val(study_test_body);
                                    break;
                            }
                        }


                    }
                });
            }
            //ee初始化题目
            function ee_actionShow() {
                var param={};
                param.train_id=train_id;
                param.section_type=4;
                param.listType=0;
                IO.get("/subjectsShow",param,function(d) {
                    if ( d.code == 0 ) {
                        //加载处理
                        $('body').css("overflow","hidden");
                        $("#cover").hide();
                        var dataAll=d.data;
                        var dataCount = dataAll.length;//题目总数
                        for ( var i = 0 ; i < dataCount ; i ++ ) {
                            var study_test_type=dataAll[i].study_test_type;//题目类型
                            var study_test_body=dataAll[i].study_test_body;//题目内容
                            var study_test_id=dataAll[i].study_test_id;//题目id
                            var study_tag=dataAll[i].study_tag;//第四模块,普通问题tag 0个体层面,1群体层面
                            switch ( study_test_type ) {
                                case 0://评分题
                                    ee3Add ();
                                    var childLast = $ ( '#ee_content' ).children ().last ();//最后一题
                                    childLast.attr('study_test_id',study_test_id);
                                    childLast.find('input').val(study_test_body);
                                    break;
                                case 1:
                                    ee1Add ();//普通问答题
                                    var childLast = $ ( '#ee_content' ).children ().last ();//最后一题
                                    childLast.attr('study_test_id',study_test_id);
                                    childLast.find('input').val(study_test_body);
                                    if(study_tag==1){
                                        childLast.find('.vocabulary_type').attr("checked",true);
                                    }else{
                                        childLast.find('.vocabulary_type').attr("checked",false);
                                    }
                                    break;
                                case 2:
                                    ee2Add ();//多问答题
                                    var childLast = $ ( '#ee_content' ).children ().last ();//最后一题
                                    childLast.attr('study_test_id',study_test_id);
                                    childLast.find('input').val(study_test_body);
                                    break;
                            }
                        }

                    }else{
                        bootbox.alert(d.msg);
                    }
                });
            }


            //点击新增题目方法
            function bbAdd() {
                bb_questionsCount+=1;
                //点击新增词汇
                $('#bb_content').append("<div class='Words_main' style='margin:20px;border: 1px solid gainsboro;height:auto;padding: 20px 20px;' vocabulary_id1='0' vocabulary_id2='0' del_flag='0'>"+
                    "<div class='row'>" +
                    "<div class='col-md-1 col-md-offset-11'>" +
                    "<div style='width:26px;height:26px;float:right;'class='bb_deleteDiv'></div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row'>"+
                    "<div class='col-md-2'>"+
                    "<div>"+
                    "<span style='font-size: large;'>词汇题</span>"+
                    "<span id='count'>"+bb_questionsCount+"</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-9'>"+
                    "<div class='row' style='margin-top: 15px;'>"+
                    "<div class='col-md-2' style='padding-top: 6px;'>"+
                    "<div>"+
                    "<span>标题</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-10'>"+
                    "<input type='text' style='height: 34px;width:100%; border: 1px solid grey;' class='vocabulary_title'/>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row' style='margin-top: 15px;'>"+
                    "<div class='col-md-2' style='padding-top: 6px;'>"+
                    "<div>"+
                    "<span>一级词汇</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-10'>"+
                    "<input type='text' style='height: 34px;width:100%; border: 1px solid grey;' class='vocabulary_section'/>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row' style='margin-top: 15px;'>"+
                    "<div class='col-md-2' style='padding-top: 6px;'>"+
                    "<div>"+
                    "<span>二级词汇</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-10'>"+
                    "<div class='row' style='margin-top: 10px;'>"+
                    "<div class='col-md-2' style='padding-top: 6px;'>"+
                    "<div>"+
                    "<span>词汇1</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-9'>"+
                    "<input type='text' style='height: 34px;width:100%; border: 1px solid grey;' class='vocabulary_name1'/>"+
                    "</div>"+
                    "<div class='col-md-1'>"+
                    "<div class='checkbox'>"+
                    "<label>"+
                    "<input type='checkbox' class='checkbox1 vocabulary_type1'>"+
                    "</label>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row' style='margin-top: 10px;'>"+
                    "<div class='col-md-2' style='padding-top: 6px;'>"+
                    "<div>"+
                    "<span>词汇2</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-9'>"+
                    "<input type='text' style='height: 34px;width:100%; border: 1px solid grey;' class='vocabulary_name2'/>"+
                    "</div>"+
                    "<div class='col-md-1'>"+
                    "<div class='checkbox'>"+
                    "<label>"+
                    "<input type='checkbox' class='checkbox2 vocabulary_type2'>"+
                    "</label>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row' style='margin-top: 15px;'>"+
                    "<div class='col-md-2' style='padding-top: 6px;'>"+
                    "<div>"+
                    "<span>词汇解释</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-10'>"+
                    "<div class='row' style='padding-top: 6px;'>"+
                    "<div class='col-md-2' style='padding-top: 6px;'>"+
                    "<div>"+
                    "<span>词汇1</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-10'>"+
                    "<div>"+
                    "<textarea class='RichText vocabulary_desc1' style='height: 260px;width:100%; border: 1px solid grey;overflow: scroll;'></textarea>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row' style='padding-top: 6px;'>"+
                    "<div class='col-md-2' style='padding-top: 6px;'>"+
                    "<div>"+
                    "<span>词汇2</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-10'>"+
                    "<div>"+
                    "<textarea class='RichText vocabulary_desc2' style='height: 260px;width:100%; border: 1px solid grey;overflow: scroll;'></textarea>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>");

                editor= KindEditor.create('textarea[class="RichText"]', {
                    uploadJson : '../../upload',
                    allowFileManager : true,
                    afterCreate : function() {
                        this.sync();
                    },
                    afterChange: function(){ //编辑器内容发生变化后，将编辑器的内容设置到原来的textarea控件里
                        this.sync();
                    },
                    afterBlur : function() {
                        this.sync();
                    }
                });

            }
            function aa1Add() {
                aa_questionsCount+=1;
                $('#aa_content').append("<div id='questions' study_test_id='0' study_test_type='1' del_flag='0' class='Problem1_main' style='margin: 20px;border: 1px solid gainsboro;height:auto;padding: 20px 20px;'>"+
                    "<div class='row'>"+
                    "<div class='col-md-1 col-xs-1 col-md-offset-11 col-xs-offset-11'>" +
                    "<div style='width:26px;height:26px;float:right;'class='aa_deleteDiv'></div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row'>"+
                    "<div class='col-md-3 col-xs-3' style='text-align: right;padding-top: 6px;'>"+
                    "<div>"+
                    "<span id='count'>"+aa_questionsCount+".</span><span>问答题型一</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-8 col-xs-8'>"+
                    "<div>"+
                    "<input type='text' style='height: 34px;width:90%; border: 1px solid grey;'/>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>");
            }
            function aa2Add() {
                aa_questionsCount+=1;
                $('#aa_content').append("<div id='questions' study_test_id='0' study_test_type='2' del_flag='0' class='Problem2_main' style='margin: 20px;border: 1px solid gainsboro;height:auto;padding: 20px 20px;'>"+
                    "<div class='row'>"+
                    "<div class='col-md-1 col-xs-1 col-md-offset-11 col-xs-offset-11'>" +
                    "<div style='width:26px;height:26px;float:right;'class='aa_deleteDiv'></div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row'>"+
                    "<div class='col-md-3 col-xs-3' style='text-align: right;padding-top: 6px;'>"+
                    "<div>"+
                    "<span id='count'>"+aa_questionsCount+".</span><span>问答题型二</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-8 col-xs-8'>"+
                    "<div>"+
                    "<input type='text' style='height: 34px;width:90%; border: 1px solid grey;'/>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>");

            }
            function aa3Add() {
                aa_questionsCount+=1;
                $('#aa_content').append("<div id='questions' study_test_id='0' study_test_type='0' del_flag='0' class='Grade_main' style='margin: 20px;border: 1px solid gainsboro;height:auto;padding: 20px 20px;'>"+
                    "<div class='row'>"+
                    "<div class='col-md-1 col-xs-1 col-md-offset-11 col-xs-offset-11'>" +
                    "<div style='width:26px;height:26px;float:right;'class='aa_deleteDiv'></div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row'>"+
                    "<div class='col-md-3 col-xs-3' style='text-align: right;padding-top: 6px;'>"+
                    "<div>"+
                    "<span id='count'>"+aa_questionsCount+".</span><span>评分题</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-8 col-xs-8'>"+
                    "<div>"+
                    "<input type='text' style='height: 34px;width:90%; border: 1px solid grey;'/>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>");

            }
            function cc1Add() {
                cc_questionsCount+=1;
                $('#cc_content').append("<div id='questions' study_test_id='0' study_test_type='1' del_flag='0'  class='Problem1_main' style='margin: 20px;border: 1px solid gainsboro;height:auto;padding: 20px 20px;'>"+
                    "<div class='row'>"+
                    "<div class='col-md-1 col-xs-1 col-md-offset-11 col-xs-offset-11'>" +
                    "<div style='width:26px;height:26px;float:right;'class='cc_deleteDiv'></div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row'>"+
                    "<div class='col-md-3 col-xs-3' style='text-align: right;padding-top: 6px;'>"+
                    "<div>"+
                    "<span id='count'>"+cc_questionsCount+".</span><span>问答题型一</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-8 col-xs-8'>"+
                    "<div>"+
                    "<input type='text' style='height: 34px;width:90%; border: 1px solid grey;'/>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>");

            }
            function cc2Add() {
                cc_questionsCount+=1;
                $('#cc_content').append("<div id='questions' study_test_id='0' study_test_type='2' del_flag='0' class='Problem2_main' style='margin: 20px;border: 1px solid gainsboro;height:auto;padding: 20px 20px;'>"+
                    "<div class='row'>"+
                    "<div class='col-md-1 col-xs-1 col-md-offset-11 col-xs-offset-11'>" +
                    "<div style='width:26px;height:26px;float:right;'class='cc_deleteDiv'></div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row'>"+
                    "<div class='col-md-3 col-xs-3' style='text-align: right;padding-top: 6px;'>"+
                    "<div>"+
                    "<span id='count'>"+cc_questionsCount+".</span><span>问答题型二</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-8 col-xs-8'>"+
                    "<div>"+
                    "<input type='text' style='height: 34px;width:90%; border: 1px solid grey;'/>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>");
            }
            function cc3Add() {
                cc_questionsCount+=1;
                $('#cc_content').append("<div id='questions' study_test_id='0' study_test_type='0' del_flag='0' class='Grade_main' style='margin: 20px;border: 1px solid gainsboro;height:auto;padding: 20px 20px;'>"+
                    "<div class='row'>"+
                    "<div class='col-md-1 col-xs-1 col-md-offset-11 col-xs-offset-11'>" +
                    "<div style='width:26px;height:26px;float:right;'class='cc_deleteDiv'></div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row'>"+
                    "<div class='col-md-3 col-xs-3' style='text-align: right;padding-top: 6px;'>"+
                    "<div>"+
                    "<span id='count'>"+cc_questionsCount+".</span><span>评分题</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-8 col-xs-8'>"+
                    "<div>"+
                    "<input type='text' style='height: 34px;width:90%; border: 1px solid grey;'/>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>");
            }
            function dd1Add() {
                dd_questionsCount+=1;
                $('#dd_content').append("<div id='questions' study_test_id='0' study_test_type='1' del_flag='0' class='Problem1_main' style='margin: 20px;border: 1px solid gainsboro;height:auto;padding: 20px 20px;'>"+
                    "<div class='row'>"+
                    "<div class='col-md-1 col-xs-1 col-md-offset-11 col-xs-offset-11'>" +
                    "<div style='width:26px;height:26px;float:right;'class='dd_deleteDiv'></div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row'>"+
                    "<div class='col-md-3 col-xs-3' style='text-align: right;padding-top: 6px;'>"+
                    "<div>"+
                    "<span id='count'>"+dd_questionsCount+".</span><span>问答题型一</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-8 col-xs-8'>"+
                    "<div>"+
                    "<input type='text' style='height: 34px;width:90%; border: 1px solid grey;'/>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>");

            }
            function dd2Add() {
                dd_questionsCount+=1;
                $('#dd_content').append("<div id='questions' study_test_id='0' study_test_type='2' del_flag='0' class='Problem2_main' style='margin: 20px;border: 1px solid gainsboro;height:auto;padding: 20px 20px;'>"+
                    "<div class='row'>"+
                    "<div class='col-md-1 col-xs-1 col-md-offset-11 col-xs-offset-11'>" +
                    "<div style='width:26px;height:26px;float:right;'class='dd_deleteDiv'></div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row'>"+
                    "<div class='col-md-3 col-xs-3' style='text-align: right;padding-top: 6px;'>"+
                    "<div>"+
                    "<span id='count'>"+dd_questionsCount+".</span><span>问答题型二</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-8 col-xs-8'>"+
                    "<div>"+
                    "<input type='text' style='height: 34px;width:90%; border: 1px solid grey;'/>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>");
            }
            function dd3Add() {
                dd_questionsCount+=1;
                $('#dd_content').append("<div id='questions' study_test_id='0' study_test_type='0' del_flag='0' class='Grade_main' style='margin: 20px;border: 1px solid gainsboro;height:auto;padding: 20px 20px;'>"+
                    "<div class='row'>"+
                    "<div class='col-md-1 col-xs-1 col-md-offset-11 col-xs-offset-11'>" +
                    "<div style='width:26px;height:26px;float:right;'class='dd_deleteDiv'></div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row'>"+
                    "<div class='col-md-3 col-xs-3' style='text-align: right;padding-top: 6px;'>"+
                    "<div>"+
                    "<span id='count'>"+dd_questionsCount+".</span><span>评分题</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-8 col-xs-8'>"+
                    "<div>"+
                    "<input type='text' style='height: 34px;width:90%; border: 1px solid grey;'/>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>");
            }
            function ee1Add() {
                ee_questionsCount+=1;
                $('#ee_content').append("<div id='questions' study_test_id='0' study_test_type='1' del_flag='0' class='Problem1_main' style='margin: 20px;border: 1px solid gainsboro;height:auto;padding: 20px 20px;'>"+
                    "<div class='row'>"+
                    "<div class='col-md-1 col-xs-1 col-md-offset-11 col-xs-offset-11'>" +
                    "<div style='width:26px;height:26px;float:right;'class='ee_deleteDiv'></div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row'>"+
                    "<div class='col-md-3 col-xs-3' style='text-align: right;padding-top: 6px;'>"+
                    "<div>"+
                    "<span id='count'>"+ee_questionsCount+".</span><span>问答题型一</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-7 col-xs-7'>"+
                    "<div>"+
                    "<input type='text' style='height: 34px;width:100%; border: 1px solid grey;'/>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-2 col-xs-2'>"+
                    "<div class='checkbox'>"+
                    "<label>"+
                    "<input type='checkbox' class='checkbox vocabulary_type'>"+
                    "</label>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>");

            }
            function ee2Add() {
                ee_questionsCount+=1;
                $('#ee_content').append("<div id='questions' study_test_id='0' study_test_type='2' del_flag='0' class='Problem2_main' style='margin: 20px;border: 1px solid gainsboro;height:auto;padding: 20px 20px;'>"+
                    "<div class='row'>"+
                    "<div class='col-md-1 col-xs-1 col-md-offset-11 col-xs-offset-11'>" +
                    "<div style='width:26px;height:26px;float:right;'class='ee_deleteDiv'></div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row'>"+
                    "<div class='col-md-3 col-xs-3' style='text-align: right;padding-top: 6px;'>"+
                    "<div>"+
                    "<span id='count'>"+ee_questionsCount+".</span><span>问答题型二</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-7 col-xs-7'>"+
                    "<div>"+
                    "<input type='text' style='height: 34px;width:100%; border: 1px solid grey;'/>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>");
            }
            function ee3Add() {
                ee_questionsCount+=1;
                $('#ee_content').append("<div id='questions' class='Grade_main' study_test_id='0' study_test_type='0' del_flag='0' style='margin: 20px;border: 1px solid gainsboro;height:auto;padding: 20px 20px;'>"+
                    "<div class='row'>"+
                    "<div class='col-md-1 col-xs-1 col-md-offset-11 col-xs-offset-11'>" +
                    "<div style='width:26px;height:26px;float:right;'class='ee_deleteDiv'></div>"+
                    "</div>"+
                    "</div>"+
                    "<div class='row'>"+
                    "<div class='col-md-3 col-xs-3' style='text-align: right;padding-top: 6px;'>"+
                    "<div>"+
                    "<span id='count'>"+ee_questionsCount+".</span><span>评分题</span>"+
                    "</div>"+
                    "</div>"+
                    "<div class='col-md-7 col-xs-7'>"+
                    "<div>"+
                    "<input type='text' style='height: 34px;width:100%; border: 1px solid grey;'/>"+
                    "</div>"+
                    "</div>"+
                    "</div>"+
                    "</div>");

            }
            


        })

     


    }

)
